fix[mono]: fix files-changed invalid after mr merged#1097
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
files-changed invalid after mr mergedfiles-changed invalid after mr merged
There was a problem hiding this comment.
Pull Request Overview
This PR fixes invalid file-change detection after merge requests and refactors storage and pack routines for better reliability and performance.
- Rename and enhance
remove_refsto filter out non-MR refs and update its usage in the API service. - Refactor batch-saving routines to use concurrent execution (
try_join_all) and improve GitDbStorage’s error propagation. - Add a migration to alter the unique index on
MegaMr, unifyfull_packwithincremental_pack, and introduce controlled concurrency and error logging in import routines.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| jupiter/src/storage/mono_storage.rs | Renamed remove_refs to remove_none_mr_refs and added MR filter |
| jupiter/src/storage/mod.rs | Made batch_save_model_with_conflict private and switched to try_join_all |
| jupiter/src/storage/git_db_storage.rs | Replaced multiple unwrap() calls with ? for batch saves |
| jupiter/migration/src/m20250605_013340_alter_mega_mr_index.rs | Created migration to drop old MR index and add new unique composite |
| jupiter/migration/src/lib.rs | Registered the new migration |
| ceres/src/pack/monorepo.rs | Simplified full_pack by delegating to incremental_pack |
| ceres/src/pack/import_repo.rs | Added semaphore for parallel saves, reduced chunk size, added logging, removed dead code |
| ceres/src/api_service/mono_api_service.rs | Updated ref-removal call, improved error handling for libra diff |
Comments suppressed due to low confidence (2)
jupiter/src/storage/mono_storage.rs:74
- [nitpick] The function name
remove_none_mr_refsis ambiguous and contains a typo. Consider renaming it toremove_non_mr_refsorremove_non_merge_refsfor clarity.
pub async fn remove_none_mr_refs(&self, path: &str) -> Result<(), MegaError> {
jupiter/migration/src/m20250605_013340_alter_mega_mr_index.rs:29
- The
downmigration is a no-op and does not revert the index changes made inup. Consider dropping the new index and recreating the old one to fully support rollback.
async fn down(&self, _: &SchemaManager) -> Result<(), DbErr> {
| .unwrap(); | ||
| // remove refs start with path | ||
| storage.remove_refs(&mr.path).await.unwrap(); | ||
| // remove refs start with path exceprt mr type |
There was a problem hiding this comment.
Typo in comment: exceprt should be except.
| // remove refs start with path exceprt mr type | |
| // remove refs start with path except mr type |
| ) -> Result<Option<Commit>, GitError> { | ||
| let storage = self.context.services.git_db_storage.clone(); | ||
| let mut entry_list = vec![]; | ||
| let semaphore = Arc::new(Semaphore::new(8)); |
There was a problem hiding this comment.
[nitpick] The semaphore limit 8 is a magic number. Extract it into a named constant or configuration to clarify its purpose and make it configurable.
| let semaphore = Arc::new(Semaphore::new(8)); | |
| let semaphore = Arc::new(Semaphore::new(SEMAPHORE_LIMIT)); |
| // let mut blob_handler = vec![]; | ||
| for chunk in bids.chunks(1000) { | ||
| let raw_storage = raw_storage.clone(); | ||
| let sender_clone = entry_tx.clone(); | ||
| let chunk_clone = chunk.to_vec(); | ||
| let handler = tokio::spawn(async move { | ||
| let mut blob_stream = | ||
| raw_storage.get_raw_blobs_stream(chunk_clone).await.unwrap(); | ||
| while let Some(model) = blob_stream.next().await { | ||
| match model { | ||
| Ok(m) => { | ||
| // todo handle storage type | ||
| let b: Blob = m.into(); | ||
| let entry: Entry = b.into(); | ||
| sender_clone.send(entry).await.unwrap(); | ||
| } | ||
| Err(err) => eprintln!("Error: {:?}", err), | ||
| // let handler = tokio::spawn(async move { |
There was a problem hiding this comment.
[nitpick] There are several commented-out blocks related to blob handling. Remove or restore this code to reduce clutter and improve readability.
No description provided.